package com.example.springboot.service.Impl;


import com.example.springboot.entity.Question;
import com.example.springboot.mapper.QuestionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QuestionServiceImpl {

    @Autowired
    private QuestionMapper questionMapper;

    public void addQuestion(Question question) {
        questionMapper.insertQuestion(question);
    }

    public Question getQuestionById(int id) {
        return questionMapper.getQuestionById(id);
    }

    public List<Question> getQuestionsByPostId(int postId) {
        return questionMapper.getQuestionsByPostId(postId);
    }

    public void updateQuestion(Question question) {
        questionMapper.updateQuestion(question);
    }

    public void deleteQuestion(int id) {
        questionMapper.deleteQuestion(id);
    }
}
